package cn.biplam.front.component.view.mdManage.buffer2md.main;

import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.AjxResponse;
import cn.biplam.front.component.data.common.ButtonComp;
import cn.biplam.front.component.view.systemManage.task.modelimport.ModelImportTaskManage;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.html.base.Const.Float_Type;
import cn.biplam.front.html.base.Const.Window_Event;
import cn.biplam.front.htmlscript.script.AjxScript;
import cn.biplam.front.htmlscript.script.PopupScript;
import cn.biplam.front.htmlscript.script.AjxScript.Level;
import cn.biplam.front.template.base.ButtonGroup;

/**
 * 模型导入缓冲区到Md的按钮组提供类
 * @author WangSong 2009-6-22下午05:21:25
 * @version 1.0
 */
public class Buffer2MdTableButton extends AjxResponse{
	
	public static final String cId="2205";
	public static final String aId="220501";
	
	/**
	 * 生成仓库对象维护操作按钮并绑定按钮事件
	 * @param mUser
	 * @return
	 * @throws ErrorMessage
	 */
	@SuppressWarnings("static-access")
	public HtmlWindow getOperators(UserInfo mUser) throws ErrorMessage{
		ButtonGroup operatorButtons=new ButtonGroup(this.cId,Float_Type.Left);
		if(recordId!=null){
			/** 增量更新 */
			HtmlWindow delBt=ButtonComp.get(mUser, "291");
			//增量更新提交脚本
			String script = AjxScript.getSpNoRefresh(cId, 
					ModelImportTaskManage.aId_Import_TO_Md,
					recordId);
			//绑定脚本到按钮
			delBt.bind(Window_Event.OnClick,script);
			operatorButtons.put(delBt);
			/** 返回 */
			HtmlWindow refreshBt=ButtonComp.get(mUser, "259");
			refreshBt.bind(Window_Event.OnClick, PopupScript.cancel("syspop"+Level.Second));
			operatorButtons.put(refreshBt);
		}
		return operatorButtons.get();
	}
	
	public HtmlWindow get(String recordID,UserInfo mUser) throws ErrorMessage{
		this.recordId=recordID;
		return getOperators(mUser);
	}
	
	@Override
	protected HtmlWindow ajxGet() throws ErrorMessage {
		return this.get(recordId, mUser);
	}
}
